]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Properly remove pages
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 13 Aug 2020 20:58:51 +0000 (17:58 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 13 Aug 2020 21:15:11 +0000 (18:15 -0300)
When the last item of an IconGridLayout page is removed,
the page itself is removed too. However, the indexes of
items of next pages are not updated, which mess up the
layout manager state.

Update the page index of the items at forward pages when
removing a page.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1406

js/ui/iconGrid.js

index 2d3a17a6261dd5a95164274e32883cb99968c7a1..12a4aed9bd6ddb5935aadeb8dfb1fff9306aed61 100644 (file)
@@ -468,6 +468,12 @@ var IconGridLayout = GObject.registerClass({
             this._unlinkItem(item);
         });
 
+        // Adjust the page indexes of items after this page
+        for (const itemData of this._items.values()) {
+            if (itemData.pageIndex > pageIndex)
+                itemData.pageIndex--;
+        }
+
         this._pages.splice(pageIndex, 1);
         this.emit('pages-changed');
     }